<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<!--react核心库-->
<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/react/18.2.0/umd/react.production.min.js" ></script>
<!--支持react操作dom-->
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<!--引入babel,用于将jsx转化为js-->
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/babel-standalone/6.26.0/babel.min.js" ></script>
</head>
<body>

<div id="test"></div>
    <script type="text/babel"> /*这里一定要写babel*/
        //1.创建类式组件
        class Weather extends React.Component{
            //render是React.Component中定义的
            constructor(props){
                super(props);
                //初始化状态
                this.state = {isHot:false}
                console.log(this);
            }
            render(){
                return <h1>今天天气很{this.state.isHot ? '炎热': '凉爽'}</h1>
            }
        }
        //2.渲染择组件到页面
        ReactDOM.render(<Weather/>,document.getElementById('test'))
    </script>

</body>
</html>